﻿@inject NetCoreCMS.IServices.IUsersService _users;
@{
    Layout = null;
    Sysconfig config = ViewData["config"] as Sysconfig;
    Userconfig uconfig = ViewData["uconfig"] as Userconfig;
    string action = ViewBag.action as string;
    Users userModel = ViewBag.userModel as Users;
    List<Shop_Bills> billsList = ViewBag.billsList as List<Shop_Bills>;
    List<Shop_Apply> applyList = ViewBag.applyList as List<Shop_Apply>;
}
<!DOCTYPE html>
<!--HTML5 doctype-->
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>商铺管理</title>
    <link rel="stylesheet" type="text/css" href="/mobile/css/style.css" />
    <script type="text/javascript" charset="utf-8" src="/mobile/js/zepto.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/weui.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/common.js"></script>
</head>

<body ontouchstart>
    <div class="page">
        <!--页面头部-->
        <div class="header">
            <a class="back" href="javascript:history.back();">
                <i class="iconfont icon-arrow-left"></i>
            </a>
            <h3>商铺管理</h3>
            <div class="right">
                <a class="weui-cell_access weui-cell_link" asp-area="Web" asp-controller="Usercenter" asp-action="Index" asp-route-act="index">
                    <i class="iconfont icon-user"></i>
                </a>
            </div>
        </div>
        <!--/页面头部-->

        <div class="page__bd">

            @if (action == "tixian")
            {
                <!--积分兑换-->
                <link rel="stylesheet" type="text/css" href="/mobile/css/validate.css" />
                <script type="text/javascript" charset="utf-8" src="/mobile/js/mvalidate.js"></script>
                <script type="text/javascript" charset="utf-8" src="/mobile/js/mvalidate-extend.js"></script>
                <script type="text/javascript">
                    $(function () {
                        //初始化表单
                        AjaxInitForm('#pointForm', '#btnSubmit', 1, '#turl');
                        //选中TAB样式
                        $(".weui-tabbar a").eq(1).addClass("weui-bar__item_on");
                    });
                </script>

                <input id="hideAmount" name="hideAmount" type="hidden" value="@userModel.amount" />
                <form id="pointForm" name="pointform" class="form-box" url="/submit_ajax/index?action=user_point_tixian">
                    <div class="weui-form-preview" style="margin-top:10px;">
                        <div class="weui-form-preview__hd">
                            <div class="weui-form-preview__item">
                                <label class="weui-form-preview__label">奖金余额</label>
                                <em class="weui-form-preview__value">¥@userModel.cash_point</em>
                            </div>
                        </div>
                        <div class="weui-form-preview__bd">
                            <div class="weui-form-preview__item">
                                <label class="weui-form-preview__label">重消余额</label>
                                <span class="weui-form-preview__value">@userModel.shop_point 元</span>
                            </div>
                            <div class="weui-form-preview__item">
                                <label class="weui-form-preview__label">提现说明</label>
                                <span class="weui-form-preview__value">@uconfig.tixian_base 的倍数，@uconfig.tixian_start 起提 @uconfig.tixian_week 可提。</span>
                            </div>
                            @if (uconfig.tixian_switch == 0)
                            {
                                <div class="weui-form-preview__item">
                                    <label class="weui-form-preview__label">温馨提示</label>
                                    <span class="weui-form-preview__value">提现功能已关闭！</span>
                                </div>
                            }
                        </div>
                    </div>

                    @if (uconfig.tixian_switch == 1)
                    {
                        <div class="weui-panel weui-panel_access">
                            <div class="weui-panel__hd">积分兑换</div>
                            <div class="weui-panel__bd">
                                <div class="weui-cells_form form-box">
                                    <div class="weui-cell">
                                        <div class="weui-cell__hd">
                                            <label class="weui-label">提现金额</label>
                                        </div>
                                        <div class="weui-cell__bd">
                                            <input id="point" name="point" type="text" class="weui-input" placeholder="请输入提现金额" data-validate="n" />
                                        </div>
                                    </div>
                                    @*
                                        <div class="weui-cell">
                                            <div class="weui-cell__hd">
                                                <label class="weui-label">登录密码</label>
                                            </div>
                                            <div class="weui-cell__bd">
                                                <input id="txtPassword" name="txtPassword" type="password" class="weui-input" placeholder="请输入登录密码" data-validate="password" />
                                            </div>
                                        </div>
                                    *@
                                </div>
                            </div>
                        </div>
                        <div class="weui-btn-area">
                            <input id="btnSubmit" name="btnSubmit" type="submit" class="weui-btn weui-btn_primary" value="确认提现" />
                        </div>
                    }
                </form>
                <!--/积分兑换-->
            }
            @if (action == "bills")
            {
                <!--积分明细-->
                <script type="text/javascript">
                    $(function () {
                        //选中TAB样式
                        $(".weui-tabbar a").eq(2).addClass("weui-bar__item_on");
                    });
                    //删除方法
                    function ExecPostBack(checkValue) {
                        if (arguments.length == 1) {
                            ExecDelete('/submit_ajax?action=user_bills_delete', checkValue, '#turl');
                        } else {
                            var valueArr = '';
                            $("input[name='checkId']:checked").each(function (i) {
                                valueArr += $(this).val();
                                if (i < $("input[name='checkId']:checked").length - 1) {
                                    valueArr += ","
                                }
                            });
                            ExecDelete('/submit_ajax?action=user_bills_delete', valueArr, '#turl');
                        }
                    }
                </script>

                <div class="detail-list">
                    <ul>
                        <!--取得分页页码列表-->
                        @foreach (Shop_Bills dr in billsList)
                        {
                            var user = _users.GetModel(dr.user_id);
                            string username = "不存在";
                            if(user!=null)
                            {
                                username = user.user_name;
                            }
                            <li>
                                <div class="detail-bd">
                                    <div class="list-box">
                                        <div class="txt-box">
                                            <h2>@dr.remark 会员:@username</h2>
                                            <p class="note">
                                                <span class="fr">
                                                    @(dr.status) @dr.point
                                                </span>
                                                <span>@dr.add_time</span>
                                            </p>
                                        </div>
                                    </div>
                                </div>
                                @*
                                    <div class="detail-ft">
                                        <div class="ft-btn">
                                            <div class="btn-box">
                                                <a href="javascript:;" onclick="ExecPostBack('@dr.id');">
                                                    <i class="iconfont icon-delete"></i>
                                                    删除
                                                </a>
                                            </div>
                                        </div>
                                    </div>*@
                            </li>
                        }
                        @if (billsList.Count == 0)
                        {
                            <div class="nodata">暂无记录...</div>
                        }
                    </ul>
                </div>

                <!--分页页码-->
                <div class="page-list">
                    @Html.Raw(ViewBag.pagelist)
                </div>
                <!--/分页页码-->

                <input id="turl" type="hidden" value="/Web/ShopCenter/Index?action=bills" /><!--存在跳转的URL值-->
                <!--/积分明细-->
            }
            @if (action == "apply")
            {
                <!--积分明细-->
                <script type="text/javascript">
                    $(function () {
                        //选中TAB样式
                        $(".weui-tabbar a").eq(3).addClass("weui-bar__item_on");
                    });
                    //删除方法
                    function ExecPostBack(checkValue) {
                        if (arguments.length == 1) {
                            ExecDelete('/submit_ajax?action=user_apply_delete', checkValue, '#turl');
                        } else {
                            var valueArr = '';
                            $("input[name='checkId']:checked").each(function (i) {
                                valueArr += $(this).val();
                                if (i < $("input[name='checkId']:checked").length - 1) {
                                    valueArr += ","
                                }
                            });
                            ExecDelete('/submit_ajax?action=user_apply_delete', valueArr, '#turl');
                        }
                    }
                </script>

                <div class="detail-list">
                    <ul>
                        <!--取得分页页码列表-->
                        @foreach (Shop_Apply dr in applyList)
                        {
                            <li>
                                <div class="detail-bd">
                                    <div class="list-box">
                                        <div class="txt-box">
                                            <h2>@dr.remark</h2>
                                            <p class="note">
                                                <span class="fr">
                                                    @(dr.send_cancel) @dr.apply_point
                                                </span>
                                                <span>@dr.add_time</span>
                                            </p>
                                        </div>
                                    </div>
                                </div>@*
                                    <div class="detail-ft">
                                        <div class="ft-btn">
                                            <div class="btn-box">
                                                <a href="javascript:;" onclick="ExecPostBack('@dr.id');">
                                                    <i class="iconfont icon-delete"></i>
                                                    删除
                                                </a>
                                            </div>
                                        </div>
                                    </div>*@
                            </li>
                        }
                        @if (applyList.Count == 0)
                        {
                            <div class="nodata">暂无记录...</div>
                        }
                    </ul>
                </div>

                <!--分页页码-->
                <div class="page-list">
                    @Html.Raw(ViewBag.pagelist)
                </div>
                <!--/分页页码-->

                <input id="turl" type="hidden" value="/Web/ShopCenter/Index?action=apply" /><!--存在跳转的URL值-->
                <!--/积分明细-->
            }
        </div>

        <!--版权信息-->
        @await Html.PartialAsync("~/Areas/Web/Views/Shared/_Copyright.cshtml")
        <!--/版权信息-->
        <!--底部导航-->
        <div class="weui-tab foot-nav">
            <div class="weui-tab__panel">

            </div>
            <div class="weui-tabbar">
                <a asp-area="Web" asp-controller="Index" asp-action="Index" class="weui-tabbar__item">
                    <i class="iconfont icon-home weui-tabbar__icon"></i>
                    <p class="weui-tabbar__label">首页</p>
                </a>
                <a asp-route-act="tixian" class="weui-tabbar__item">
                    <i class="iconfont icon-amount weui-tabbar__icon"></i>
                    <p class="weui-tabbar__label">提现</p>
                </a>
                <a asp-route-act="bills" class="weui-tabbar__item">
                    <i class="iconfont icon-log weui-tabbar__icon"></i>
                    <p class="weui-tabbar__label">收支</p>
                </a>
                <a asp-route-act="apply" class="weui-tabbar__item">
                    <i class="iconfont icon-book weui-tabbar__icon"></i>
                    <p class="weui-tabbar__label">申请</p>
                </a>
            </div>
        </div>
        <!--/底部导航-->
    </div>
</body>
</html>
